package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "follow_up", schema = "springboot", catalog = "")
public class FollowUp {
    private int followId;
    private String followContext;
    private Date fnextContactTime;
    private Timestamp followTime;
    private BusinessInfo businessInfoByBusinesId;
    private String followType;
    private Emp followEmp;


    @Id
    @Column(name = "follow_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getFollowId() {
        return followId;
    }

    public void setFollowId(int followId) {
        this.followId = followId;
    }

    @Basic
    @Column(name = "follow_context")
    public String getFollowContext() {
        return followContext;
    }

    public void setFollowContext(String followContext) {
        this.followContext = followContext;
    }

    @Basic
    @Column(name = "fnext_contact_time")
    public Date getFnextContactTime() {
        return fnextContactTime;
    }

    public void setFnextContactTime(Date fnextContactTime) {
        this.fnextContactTime = fnextContactTime;
    }

    @Basic
    @Column(name = "follow_time")
    public Timestamp getFollowTime() {
        return followTime;
    }

    public void setFollowTime(Timestamp followTime) {
        this.followTime = followTime;
    }

    @Basic
    @Column(name = "follow_type")
    public String getFollowType() {
        return followType;
    }

    public void setFollowType(String followType) {
        this.followType = followType;
    }

    @ManyToOne
   @JoinColumn(name = "follow_emp",referencedColumnName = "employees_id")
    public Emp getFollowEmp() {
        return followEmp;
    }

    public void setFollowEmp(Emp followEmp) {
        this.followEmp = followEmp;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        FollowUp followUp = (FollowUp) o;
        return followId == followUp.followId &&
                Objects.equals(followContext, followUp.followContext) &&
                Objects.equals(fnextContactTime, followUp.fnextContactTime) &&
                Objects.equals(followTime, followUp.followTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(followId, followContext, fnextContactTime, followTime);
    }

    @ManyToOne
    @JoinColumn(name = "busines_id", referencedColumnName = "busines_id")
    public BusinessInfo getBusinessInfoByBusinesId() {
        return businessInfoByBusinesId;
    }

    public void setBusinessInfoByBusinesId(BusinessInfo businessInfoByBusinesId) {
        this.businessInfoByBusinesId = businessInfoByBusinesId;
    }



    @Override
    public String toString() {
        return "FollowUp{" +
                "followId=" + followId +
                ", followContext='" + followContext + '\'' +
                ", fnextContactTime=" + fnextContactTime +
                ", followTime=" + followTime +
                ", businessInfoByBusinesId=" + businessInfoByBusinesId +
                '}';
    }
}
